//
//  NewsTypeModel.m
//  news_ios_app
//
//  Created by apple on 16/3/15.
//  Copyright © 2016年 apple. All rights reserved.
//

#import "NewsTypeModel.h"

@implementation NewsTypeModel

-(instancetype)init
{
    if (self = [super init]) {
        _ID = nil;
        _desc = nil;
        _type_name = nil;
    }
    return self;
}

+(instancetype)modelWithDictionary:(NSDictionary *)dictionary
{
    NewsTypeModel *instance = [NewsTypeModel new];
    if (!dictionary) {
        return nil;
    }
    if (![dictionary isKindOfClass:[NSDictionary class]]) {
        return nil;
    }
    
    if (!IsNilOrNull([dictionary objectForKey:@"id"])) {
        instance.ID = [[dictionary objectForKey:@"id"] stringValue];
    }
    
    if (!IsStrEmpty([dictionary objectForKey:@"desc"])) {
        instance.desc = [dictionary objectForKey:@"desc"];
    }
    
    if (!IsStrEmpty([dictionary objectForKey:@"type_name"])) {
        instance.type_name = [dictionary objectForKey:@"type_name"];
    }
    return instance;
}


- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [[self class]modelWithDictionary:dictionary];
    return self;
}
@end
